﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Landscape.Business.Reporting;
using Landscape.Business.FNH.Activities;

namespace Landscape.WebApp.Internal
{
    public partial class OmniReports : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            //EmergencyActivities ea = new EmergencyActivities();
            
            //IncidentDetails incDetReport = new IncidentDetails();
            //incDetReport.IncidentID = ea.GetEmergencyIncidentsByTitle(string.Empty, 0, -1).ToList()[1].ID;
            //this.ReportViewer1.Report = incDetReport;

            if (Request.QueryString["RPTID"] != null && Request.QueryString["RPTID"].Trim() != string.Empty)
            {
                switch (Request.QueryString["RPTID"].Trim())
                {
                    case "IDET":
                        {
                            if (Request.QueryString["INCID"] != null && Request.QueryString["INCID"].Trim() != string.Empty)
                            {
                                var incDetReport = new IncidentDetails(Guid.Parse(Request.QueryString["INCID"].Trim()));
                                incDetReport.IncidentID = Guid.Parse(Request.QueryString["INCID"].Trim());
                                this.ReportViewer1.Report = incDetReport;
                            }

                            Page.Title = "Emergency Incident Details";

                            break;
                        }

                    case "FEED":
                        {
                            if (Request.QueryString["INCID"] != null && Request.QueryString["INCID"].Trim() != string.Empty)
                            {
                                var incDetFeedbackReport = new IncidentFeedback();
                                incDetFeedbackReport.IncidentID = Guid.Parse(Request.QueryString["INCID"].Trim());
                                this.ReportViewer1.Report = incDetFeedbackReport;
                            }

                            Page.Title = "Emergency Incident Feedback";

                            break;
                        }
                }
            }
        }
    }
}